package kr.hkit.androidcomplete01.chapter08;

import android.app.Activity;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.Toast;

public class HandleEventListener extends Activity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		View v = new View(this);
		v.setOnTouchListener(touchListener);
		setContentView(v);
	}
	
	TouchListener touchListener = new TouchListener();
	
	class TouchListener implements OnTouchListener{
		public boolean onTouch(View v, MotionEvent event) {
			if (event.getAction()== MotionEvent.ACTION_DOWN){
				Toast.makeText(HandleEventListener.this, "Touch Event Received", Toast.LENGTH_LONG).show();
				return true;
			}
			return false;
		}
	}
}
